<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * RendicionDetalle filter form base class.
 *
 * @package    filters
 * @subpackage RendicionDetalle *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseRendicionDetalleFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'dias'           => new sfWidgetFormFilterInput(),
      'dinero_dia'     => new sfWidgetFormFilterInput(),
      'gastos'         => new sfWidgetFormFilterInput(),
      'total'          => new sfWidgetFormFilterInput(),
      'menos_anticipo' => new sfWidgetFormFilterInput(),
      'cobrar'         => new sfWidgetFormFilterInput(),
      'devolver'       => new sfWidgetFormFilterInput(),
      'id_rendicion'   => new sfWidgetFormDoctrineChoice(array('model' => 'Rendicion', 'add_empty' => true)),
      'id_afiliado'    => new sfWidgetFormDoctrineChoice(array('model' => 'Afiliado', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'dias'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'dinero_dia'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'gastos'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'total'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'menos_anticipo' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cobrar'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'devolver'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_rendicion'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Rendicion', 'column' => 'id')),
      'id_afiliado'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Afiliado', 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('rendicion_detalle_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'RendicionDetalle';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'dias'           => 'Number',
      'dinero_dia'     => 'Number',
      'gastos'         => 'Number',
      'total'          => 'Number',
      'menos_anticipo' => 'Number',
      'cobrar'         => 'Number',
      'devolver'       => 'Number',
      'id_rendicion'   => 'ForeignKey',
      'id_afiliado'    => 'ForeignKey',
    );
  }
}